#!/usr/bin/perl

use utf8;
use strict;
use warnings;

my $in = $ARGV[0];

my $out = $in;
$out =~ s/(\.\w+)/.out/;

#print $out;

open  my $in_fn, "<$in" or die $!;
my $out_str;

while (<$in_fn>) {
	s/Fred/\*/gi;
	s/Wilma/Fred/gi;
	s/\*/Wilma/gi;
	$out_str .= $_;
}

open my $out_fn, ">$out";
syswrite $out_fn, $out_str;